{% extends "office/equipment.html" %}
{% block content %}
<form id="input_form" class="form-inline" action="" method="post">
    {% csrf_token %}
    <div class="row">
          <div class="col-md-4 form-group">
              <label for="number"><span style="color: red;font-weight:bold">*</span>设备编号: </label>
              <input id="number" class="form-control" type="text" name="number" value="{{ equipment.number }}">
          </div>
          <div class="col-md-4 form-group">
              <label for="user">当前使用者：</label>
              <input id="user" class="form-control" type="text" name="user" value="{{ equipment.user }}">
          </div>
    </div>
    <br>

    <div class="row">
          <div class="col-md-4 form-group">
              <label for="model"><span style="color: red;font-weight:bold">*</span>设备型号：</label>
              <input id="model" class="form-control" type="text" name="model" value="{{ equipment.model }}">
          </div>
          <div class="col-md-4 form-group">
              <label for="series">设备序列号：</label>
              <input id="series" class="form-control" type="text" name="series" value="{{ equipment.series }}">
          </div>
          <div class="col-md-4 form-group">
             <label for="status">当前状态：</label>
             <select name="status" id="status" class="form-control">
                <option>使用中</option>
                <option>在库存</option>
                <option>待回收</option>
                <option>已报废</option>
             </select>
             <script>
                  $(document).ready(function () {
                      $("#status").find("option:contains({{ equipment.status }})").attr("selected",true);
                  })
              </script>
          </div>
    </div>
    <br>

    <div class="row">
          <div class="col-md-4 form-group">
              <label for="source">设备来源：</label>
              <input id="source" class="form-control" type="text" name="source" value="{{ equipment.source }}">
          </div>
          <div class="col-md-4 form-group">
              <label for="price">设备成本：</label>
              <input id="price" class="form-control" type="text" name="price" value="{{ equipment.price }}">
          </div>
          <div class="col-md-4 form-group">
              <label for="first_enter_date">首次入库日期：</label>
              <input id="first_enter_date" class="form-control datepicker" type="text" name="first_enter_date" value="{{ equipment.first_enter_date }}">
          </div>
    </div>
    <br>

    <div class="row">
          <div class="col-md-4 form-group">
              <label for="last_out_date">最近出库日期：</label>
              <input id="last_out_date" class="form-control datepicker" type="text" name="last_out_date" value="{{ equipment.last_out_date }}">
          </div>
          <div class="col-md-4 form-group">
            <label for="registrant">设备出库人：</label>
            <select name="registrant" id="registrant" class="form-control">
                <option>none</option>
                <option>richerd</option>
                <option>ian</option>
                <option>lijian</option>
                <option>tyler</option>
                <option>mark</option>
                <option>joyce</option>
                <option>other</option>
            </select>
            <script>
                  $(document).ready(function () {
                      $("#registrant").find("option:contains({{ equipment.registrant }})").attr("selected",true);
                  })
             </script>
          </div>
          <div class="col-md-4 form-group">
             <label for="remark">设备备注信息(限1200字)：</label>
             <textarea id="remark" class="form-control" name="remark" rows="5" cols="40">
{{ equipment.remark }}
             </textarea>
        </div>
    </div>
    <br>

    <button id="submit_button" type="submit" class="btn btn-primary">保存</button>
    <a class="btn btn-primary" href="/office/show_equipment/{{ equipment.number }}" role="button">取消</a>
</form>
<script>
$(document).ready($("#submit_button").click(function () {

    $('#input_form input,textarea').each(function () {
        $(this).val($.trim($(this).val()));
    });

}));
</script>
<script>
    $(function () {
        $(".datepicker").datepicker({
            autoclose: true,
            language: "zh-CN",
            defaultViewDate: 'today',
            orientation: 'bottom',
            todayBtn: true,
            todayHighlight: true
        });
    })
</script>
{% endblock %}